package form4;

import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;
import java.util.List;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import FMS.Form4;

public class ViewForm4 extends WebPage {
	
	public ViewForm4() throws IOException, SQLException {
		Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");
		SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
		
		Form form = new Form("ViewForm4form");
		
        List<Form4> list = (List<Form4>)sqlMap.queryForList("Form4.getAll");
		
		ListView eachRecord = new ListView("eachRecord", list) {
			
		
			private static final long serialVersionUID = 1L;
			
			protected void populateItem(ListItem item) {
				final Form4 form4 = (Form4) item.getModelObject();
				item.add(new Label("liquidationFormNoId", form4.getLiquidationFormNoId()));
				item.add(new Label("nameOfRecipientofRCA", form4.getNameOfRecipientofRCA()));
				item.add(new Label("perCashVoucherNo", form4.getPerCashVoucherNo()));
				item.add(new Label("dateFiled", form4.getDateFiled()));
				item.add(new Label("amountReceived", form4.getAmountReceived()));
				item.add(new Label("totalAmountDisbursed", form4.getTotalAmountDisbursed()));
				item.add(new Label("amountToBeReturned", form4.getAmountToBeReturned()));
				item.add(new Label("receiverForAmountRefunded", form4.getReceiverForAmountRefunded()));
				item.add(new Label("dateAudited", form4.getDateAudited()));
				item.add(new Label("dateReceiverReceivedAmountRefunded", form4.getDateReceiverReceivedAmountRefunded()));
				item.add(new Label("status", form4.getStatus()));
				//item.add(new BookmarkablePageLink("view", Form4SubList.class));
				
			}
		};
		
		form.add(eachRecord);
		add(form);
		
	}
	
}
